import { RouteRecordRaw } from 'vue-router';
import { MainLayout, Layout } from '@/router/constant';
import { ProjectOutlined, DashboardOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/gs/sys',
    name: 'gs_sys',
    component: Layout,
    meta: {
      isRoot: true,
      activeMenu: 'gs_sys_user',
      icon: renderIcon(DashboardOutlined),
      permissions: ['user_list', 'device_list'],
    },
    children: [
      {
        path: 'user',
        name: 'gs_sys_user',
        component: () => import('@/views/water/user/index.vue'),
        meta: {
          title: '用户列表',
          activeMenu: 'gs_sys_user',
          permissions: ['user_list'],
        },
      },
      {
        path: 'device',
        name: 'gs_sys_device',
        component: () => import('@/views/water/device/index.vue'),
        meta: {
          title: '设备选择',
          activeMenu: 'gs_sys_device',
          permissions: ['device_list'],
        },
      },
    ],
  },
  {
    path: '/gs/user',
    name: 'gs_user',
    component: MainLayout,
    meta: {
      isRoot: true,
      activeMenu: 'gs_user_index',
      hidden: true,
      showInLayoutMain: true,
      icon: renderIcon(ProjectOutlined),
    },
    children: [
      {
        path: 'index',
        name: 'gs_user_index',
        meta: {
          title: '用户列表',
          activeMenu: 'gs_user_index',
        },
        component: () => import('@/views/user-page/index.vue'),
      },
    ],
  },
  {
    path: '/gs/device',
    name: 'gs_device',
    component: MainLayout,
    meta: {
      isRoot: true,
      activeMenu: 'gs_device_index',
      icon: renderIcon(ProjectOutlined),
      hidden: true,
      showInLayoutMain: true,
    },
    children: [
      {
        path: 'index',
        name: 'gs_device_index',
        meta: {
          title: '设备列表',
          activeMenu: 'gs_device_index',
        },
        component: () => import('@/views/device-page/index.vue'),
      },
    ],
  },
];

export default routes;
